﻿using System;
using System.Data;
using System.Web;
using System.Web.UI.WebControls;
using Texfina.Core.Common;  
using Texfina.Core.Web;
using Texfina.Common.Mg;
using Texfina.Core.Data;  
using Texfina.Entity.Rh;
using Texfina.Entity.Mg;
using RHBOQry = Texfina.BOQry.Rh;
using MGBOQry = Texfina.BOQry.Mg;

namespace RH
{
   public partial class wfProcPlani : SearchPage 
   {
        public const int _GRDLIST_STANULADO = 10;
    
      protected void Page_Load(object sender, EventArgs e)
      {
                       
         this.LoadInitialSettings();
         if(this.IsPostBack){
            this.LoadInPostBack();
            return;
         } 

         this.LoadData();

      }

      public override void LoadInitialSettings()
      {
         Label lbl = (Label) this.Master.FindControl("lblTitle");
         lbl.Text = "Proceso Planilla";
         this.Page.Form.DefaultButton = bttSearch.UniqueID;
      }

      public override void SearchData()
      {
          EProcPlaniBandeja objE = new EProcPlaniBandeja();

          objE.IdPeriodo= Session[ConstSessionVar.PERIODO].ToString();
          objE.IdEmpresa= Session[ConstSessionVar.EMPRESA].ToString();
          objE.IdMes = Request.QueryString["IdMes"].ToString();
          objE.IdForPago = Request.QueryString["IdFormaPago"].ToString();

          if (this.txtidPlanilla.Text == "")
              objE.IdPlanilla = null;
          else
              objE.IdPlanilla = this.txtidPlanilla.Text;

          if (this.txtdsPlanilla.Text == "")
              objE.DsPlanilla = null;
          else
              objE.DsPlanilla = this.txtdsPlanilla.Text;




          IBOQuery objBO = (IBOQuery)WCFHelper.GetObject<IBOQuery>(typeof(RHBOQry.ProcPlani));
          DataTable dt = objBO.GetByCriteria(objE);




          this.GridSetDataBinding(grdList, dt);

      }
      
      protected void grdList_RowCreated(object sender, GridViewRowEventArgs e)
      {
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
            e.Row.Attributes.Add("ondblclick", "rowDblClick(" + e.Row.RowIndex.ToString() + ")");
         }
      }

      protected void bttOk_Click(object sender, EventArgs e)
      {
          this.SearchData();
      }
   }
}